package com.xpresso.utils.date;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils {

	public static String formatDateToMysql(Date theDate){
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return format.format(theDate);
	}
	
	public static Date parseMysqlDate(String theDate) throws ParseException{
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return format.parse(theDate);
	}
	
	public static String formatDateToMysql(Date theDate, String stringFormat){
		SimpleDateFormat format = new SimpleDateFormat(stringFormat);
		return format.format(theDate);
	}
	
}
